package game.game.network.cmd;

import json.JSONObject;
import entity.Position;
import entity.object.GameEntityType;
import game.engine.network.client.IControllerClient;
import game.engine.network.cmd.CmdServer;
import game.engine.network.cmd.EnumCommand;
import game.game.network.client.IGameClientController;

public class CmdSReturnPosition extends CmdServer
{
	protected static String GAME_ENTITY_TYPE = "get";

	public CmdSReturnPosition(JSONObject pObject)
	{
		super( pObject );
	}

	public CmdSReturnPosition(Position pPosition, Integer pIdObj, Integer pGameEntityType)
	{
		super( EnumCommand.CMD_SERV_RETURN_POSITION );
		addParam( CmdSReturnPosition.POSITIONX , pPosition.getX() );
		addParam( CmdSReturnPosition.POSITIONY , pPosition.getY() );
		addParam( CmdSReturnPosition.IDOBJ , pIdObj );
		addParam( GAME_ENTITY_TYPE , pGameEntityType );
	}

	public Integer getIdObj()
	{
		return (Integer) getParam( CmdSReturnPosition.IDOBJ );
	}

	public Integer getPositionX()
	{
		return (Integer) getParam( CmdSReturnPosition.POSITIONX );
	}

	public Integer getPositionY()
	{
		return (Integer) getParam( CmdSReturnPosition.POSITIONY );
	}

	public Integer getGameEntityType()
	{
		return (Integer) getParam( CmdSReturnPosition.GAME_ENTITY_TYPE );
		// TODO
		// return GameEntityType.
		// return GameEntityType.PLAYER;
	}

	@Override
	public void execute( IControllerClient pController )
	{
		((IGameClientController) pController).execute( this );
	}

}
